<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>

    <style>
        ul {
            list-style: none;
            margin: 0;
            padding: 0;
        }

        li {
            margin-top: 10px;
            height: 52px;
        }
    </style>
</head>

<body>
    <ul>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
        <li></li>
    </ul>

    <script>
        let lis = document.querySelectorAll('li')
        for (let i = 0; i < lis.length; i++) {
            if (i % 2 == 0) {
                lis[i].style.backgroundColor = '#000'
            } else {
                lis[i].style.backgroundColor = '#aaa'
            }
        }
    </script>
</body>

</html>